/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package database;

import utils.Debug;

/**
 *
 * @author Administrator
 */
public class SmsInfo {

    public static final String CODE_NAP = "KSNAP";
    public static final String NUMBER_NAP = "8085";
    private String codeSms;
    private String accountName;
    private String serviceNumber;
    private String senderNumber;
    private boolean isGetPass;
    private String operator;
    private String commandCode;
    private int requestId;
    private String cpName;
    private String mtMessage;

    public void setCpName(String cpName) {
        this.cpName = cpName;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public void setCommandCode(String commandCode) {
        this.commandCode = commandCode;
    }

    public void setMtMessage(String mtMessage) {
        this.mtMessage = mtMessage;
    }

    public void setRequestId(int requestId) {
        this.requestId = requestId;
    }

    public void setSenderNumber(String senderNumber) {
        this.senderNumber = senderNumber;
        Debug.d("sender number :" + senderNumber);
    }

    public String getSenderNumber() {
        return senderNumber;
    }

    public boolean isIsGetPass() {
        return isGetPass;
    }

    public void setInfo(String infoString) {
        Debug.d("info string :" + infoString);
        String[] part = infoString.split(" ");
        codeSms = "";
        accountName = "";
        if (part.length >= 2) {
            if (part[0].toUpperCase().equals("FG")) {
                setInfo(part);
                return;
            }
            if (part[0].toUpperCase().equals("KSNAP")) {
                setInfo(part);
                return;
            }
            if (part[0].toUpperCase().equals("XU")) {
                setInfo(part);
                return;
            }
        }
        if (part.length >= 4 && (part[0].equals("MOGA") || part[0].equals("NAP"))) {
            codeSms = part[0].toUpperCase() + " " + part[1].toUpperCase() + " " + part[2].toUpperCase();
            if (part[3].toUpperCase().equals("MK")) {
                isGetPass = true;
                for (int i = 4; i < part.length; i++) {
                    accountName += part[i] + " ";
                }
                return;
            }
            for (int i = 3; i < part.length; i++) {
                accountName += part[i] + " ";
            }
            return;
        }
        if (part.length >= 3) {
            codeSms = part[0].toUpperCase() + " " + part[1].toUpperCase();
            if (part[2].toUpperCase().equals("MK")) {
                isGetPass = true;
                for (int i = 3; i < part.length; i++) {
                    accountName += part[i] + " ";
                }
                return;
            }
            for (int i = 2; i < part.length; i++) {
                accountName += part[i] + " ";
            }

        }
    }

    private void setInfo(String[] part) {
        codeSms = part[0];
        if (part[1].toUpperCase().equals("MK")) {
            isGetPass = true;
            for (int i = 2; i < part.length; i++) {
                accountName += part[i] + " ";
            }
            return;
        }
        for (int i = 1; i < part.length; i++) {
            accountName += part[i] + " ";
        }

    }

    public void setServiceNumber(String serviceCode) {
        this.serviceNumber = serviceCode;
    }

    public String getServiceCode() {
        return this.serviceNumber;
    }

    public String getAccName() {
        return this.accountName;
    }

    public void setAccName(String smsInfo) {
        this.accountName = smsInfo;
    }

    public String getCodeSms() {
        return this.codeSms;
    }

    public String getServiceNumber() {
        return serviceNumber;
    }

    public String getCommandCode() {
        return commandCode;
    }

    public String getCpName() {
        return cpName;
    }

    public String getOperator() {
        return operator;
    }

    public int getRequestId() {
        return requestId;
    }
}
